<template>
  <div>
    <button>SomeBill</button>
    <ElForm label-width="auto">
      <ElFormItem label="物品名称">
        <ElInput v-model="material.materialName"></ElInput>
      </ElFormItem>
      <ElFormItem label="单价">
        <ElInputNumber v-model="material.suggestPrice"></ElInputNumber>
      </ElFormItem>
      <ElButton type="primary" @click="insert">提交</ElButton>
    </ElForm>
  </div>
</template>
<script lang="ts">
import { ElInputNumber } from 'element-plus'

/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from
import axios from 'axios'
export default {
  name: 'AboutView',
  props: {
    sampleP: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      sampleD: 'value',
      material: {
        materialCode: null,
        materialName: 'xxx',
        suggestPrice: 100.0
      }
    }
  },
  computed: {
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    async insert() {
      console.log('send material : ', this.material)
    //   js promise 事件循环 异步函数
      const res  = await axios({
        method: 'post',
        url: 'http://localhost:8080/insert',
        data: this.material
      })
      console.log(res)
    }
  },
  watch: {
    // sampleP(n, o) {},
  },
  components: { ElInputNumber }
}
</script>

<!--<style scoped>-->
<style lang="css" scoped>
.el-form {
  width: 200px;
}
</style>
